define(['app'], function(app) {
	'use strict';

	var controller = function controller($scope, Shopcustom, GoDialog, GoPage, $stateParams, $window) {
		$scope.store_id = $stateParams.store_id;
		$scope.init_data = function() {
			Shopcustom.contact_show($scope.store_id, function(data) {
				if(data != null)
					$scope.datas = data;
				else
					$scope.datas = new Object();
			})
		}
		$scope.do_tel = function(param) {
			if(param.type == 2) {
				$window.location.href = "tel:" + param.value;
			} else if(param.type == 1) {
				//				GoPage.go_txcall($scope.store_id,$scope.store_id);
				if(param.isonline == '0') {
					GoPage.go_txcall3(param.id, param.code, param.vvckey);
				} else {
					GoPage.go_txcall2($scope.store_id, $scope.store_id, param.id, param.code, param.vvckey);
				}
			}
		}
		//画面加载
		$scope.$on('$ionicView.afterEnter', function(scope, status) {
			$scope.init_data();
		});
	}

	controller.$inject = ['$scope', 'Shopcustom', 'GoDialog', 'GoPage', '$stateParams', '$window'];

	return app.registerController("shopcustomctrl", controller);
});